home *** CD-ROM | disk | FTP | other *** search
/ Megahits 5 / Megahits 5 (1994)(GTI - Rhein-Main-Soft)(DE)(Disc 2 of 2)[!].iso / archive / print / ll.lha / manual.txt < prev    next >
Text File  |  1994-02-16  |  26KB  |  1,484 lines

  1.                                     LL v2.0
  2.  
  3.                            A Label Language Compiler
  4.  
  5.  
  6.  
  7.                             © 1994 Kevin A. McHugh
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31. DISCLAIMER
  32.  
  33.  
  34.  
  35. THIS SOFTWARE IS PROVIDED "AS IS" AND NO WARRANTIES ARE OFFERED 
  36. NOR WILL ANY LIABILITY BE ASSUMED DUE TO ITS USE.  THIS SOFTWARE 
  37. HAS BEEN THOROUGHLY TESTED OVER MONTHS AND HAS BEEN FOUND 
  38. TO BE DEFECT-FREE.
  39.  
  40.  
  41.  
  42. THIS SOFTWARE IS FREE OF CHARGE "FREEWARE."  NO MONEY SHALL BE 
  43. CHARGED FOR THIS PROGRAM EXCEPT DISTRIBUTION/COPYING COSTS 
  44. WHICH HAVE NOT TO EXCEED $5 US.  THE LL PACKAGE MAY BE DISTRIB
  45. UTED IN ANY FORM, ELECTRONICALLY OR OTHERWISE AS LONG AS THE 
  46. FULL CONTENTS REMAIN IN THE ARCHIVE.
  47.  
  48.  
  49.  
  50. THE SOURCE CODE IS NOT INCLUDED BUT MAY BE OBTAINED FROM THE 
  51. AUTHOR.
  52.  
  53.  
  54.  
  55. Kevin A. McHugh
  56.  
  57. 4671 Mebane Rogers Road.
  58.  
  59. Mebane, NC 27302
  60.  
  61. U.S.A.
  62.  
  63.  
  64.  
  65. Internet:    mchugh@hamlet.uncg.edu
  66.  
  67. FidoNet:    sysop@1:3644/13.0
  68.  
  69. BBS:        (919) 563-0183
  70.  
  71. Introduction
  72.  
  73.  
  74.  
  75. What is LL?  LL is a compiler that takes your source code and produces formatted 
  76. output based on instructions in the code.  I wrote this program because every month 
  77. I distribute postcards for the local Amiga users group and had not found a flexible 
  78. utility for making both the addresses on the front and the text on the back of the 
  79. card.
  80.  
  81.  
  82.  
  83. I had wanted to use my compiler skills for a while so they wouldn't get rusty and 
  84. this is why I chose a Shell based interface over the standard GUI of the Amiga.  Due 
  85. to the fact this is a Shell interface it can easily be ported to any platform that will 
  86. compile ANSI-C.
  87.  
  88.  
  89.  
  90. LL reads source files that are written in a language I call "L."  It reads instructions 
  91. and blocks of data and then produces a final result based on your code.  L is a very 
  92. simple language and even if you don't program it will not be hard for you to use.
  93.  
  94.  
  95.  
  96. Before you use the program please read and acknowledge the disclaimer on the 
  97. previous page.  For program support and information I can be reached at the re
  98. sources shown above.  Internet mail is preferred.
  99.  
  100.  
  101.  
  102.  
  103.  
  104. The Language "L"
  105.  
  106.  
  107.  
  108. L is a very simple and easy language.  It's format is modelled after the C language.  
  109. Unlike a true language it doesn't offer input/output or user interaction.  It is more 
  110. closely related to other text compilers such as the Unix "troff" etc..
  111.  
  112.  
  113.  
  114. The language is defined as follows:
  115.  
  116.  
  117.  
  118. 1.    Variables
  119.  
  120. 2.    Printer Commands
  121.  
  122. 3.    The Data
  123.  
  124. 4.    Data Functions
  125.  
  126. 5.    Printer Commands
  127.  
  128. 6.    Functions
  129.  
  130.  
  131.  
  132. Comments can be used anywhere throughout the source file.  L accepts the standard 
  133. C comments and the newer C++ comments.  A C comment is a block of text that 
  134. starts with /* ends with */  and has anything in-between.  The newer C++ comments 
  135. are started with // and terminate at the end of the same line.  Note:  You cannot 
  136. nest comments.
  137.  
  138.  
  139.  
  140. /*
  141.  
  142. ** This Is A C Comment 
  143.  
  144. */
  145.  
  146.  
  147.  
  148. //  This Is A C++ Comment  ;-)
  149.  
  150.  
  151.  
  152. L is a case-insensitive language, basically this means that if L sees the words 
  153. PRINT, print, Print, PrInT or any combination it interprets them all as the print 
  154. command.  Normally we type everything in lower or UPPER case for comprehen
  155. sion.  Any data enclosed in a data block is case sensitive so you control exactly 
  156. what is being output.
  157.  
  158.  
  159.  
  160. Generally speaking, all white space is ignored unless relevant.  This means that you 
  161. can format your L code however makes you feel comfortable, the program is smart 
  162. enough to know when to skip white space and when to keep it.  By definition, white 
  163. space is any character which you cannot regularly see.  (carriage returns, linefeeds, 
  164. spaces, tabs etc...)
  165.  
  166.  
  167.  
  168.  
  169.  
  170. 1. Variables
  171.  
  172.  
  173.  
  174. L has pre-defined variables for formatting your text.  You can use them however you 
  175. like and in whatever order you like as long as they precede what you want to print.  
  176. All variables are entered in the following format:
  177.  
  178.  
  179.  
  180. #define variable_name  =  value ;
  181.  
  182.  
  183.  
  184. Where variable_name is one of the pre-defined variables and value is a valid value.  
  185. The equal sign "=" is optional but the compiler will produce a warning if it is omit
  186. ted.
  187.  
  188.  
  189.  
  190. The variables are as follows:
  191.  
  192.  
  193.  
  194. device
  195.  
  196. height
  197.  
  198. width
  199.  
  200. space
  201.  
  202. indent
  203.  
  204. header
  205.  
  206. footer
  207.  
  208. postage
  209.  
  210. eol
  211.  
  212.  
  213.  
  214.  
  215.  
  216. DEVICE
  217.  
  218.  
  219.  
  220. Example:    #define device = prt:;
  221.  
  222. Default:   l.out
  223.  
  224.  
  225.  
  226. The device variable tells the compiler where to send the output it generates.  Out
  227. put can go to a text file or a device such as a printer.  If you choose the device to be 
  228. prt: (the standard AmigaDOS printer device) then all printer information from Pre
  229. ferences will be used.  If you will be using the Postnet bar code feature of LL then in 
  230. order for your output to come out correctly you will need to select the PAR: device 
  231. as your final output destination.  Postnet will be discussed later in the manual.
  232.  
  233.  
  234.  
  235. Generally it is best to send output to a temporary file until you have everything cor
  236. rect for final printing.  This can be done by specifying a filename instead of a device 
  237. like follows:
  238.  
  239.  
  240.  
  241. #define device = test.output;
  242.  
  243. #define device = "address list";
  244.  
  245.  
  246.  
  247. Note that you need to quote the filename if it contains spaces.  If you enter multiple 
  248. device entries then only the last one will be used.
  249.  
  250.  
  251.  
  252.  
  253.  
  254. HEIGHT
  255.  
  256.  
  257.  
  258. Example:    #define height = 24;
  259.  
  260. Default:   10
  261.  
  262.  
  263.  
  264. The height variable sets the height of the output form so that correct paper han
  265. dling will be produced.  The height is in printer lines.  If you know the height in 
  266. inches you can easily derive the height in lines:
  267.  
  268.  
  269.  
  270. lines  =   height_in_inches  *  lines_per_inch
  271.  
  272.  
  273.  
  274. Your printer manual and Workbench preferences will show you how many lines per 
  275. inch your printer is set for.  Note that height must be an integer and cannot contain 
  276. a floating point value.
  277.  
  278.  
  279.  
  280.  
  281.  
  282. WIDTH
  283.  
  284.  
  285.  
  286. Example:    #define width = 60;
  287.  
  288. Default:   40
  289.  
  290.  
  291.  
  292. The width variable specifies the width of the output form.  The width is measured in 
  293. characters.  A standard letter sized 8.5" x 11" page prints 80 characters across so 
  294. you can estimate approximately 10 characters per inch (CPI).  Your CPI rate will be 
  295. found in your printers manual and information on how to change it will also be 
  296. available.  Note that width must be an integer.
  297.  
  298.  
  299.  
  300. SPACE
  301.  
  302.  
  303.  
  304. Example:    #define space = 10;
  305.  
  306. Default:   2
  307.  
  308.  
  309.  
  310. The space variable indicates the number of lines to feed the paper before printing 
  311. should commence.  Like the height, space is measured in printer lines.  For obvious 
  312. reasons, space should be less than the page height.  Note space must also be an 
  313. integer.
  314.  
  315.  
  316.  
  317.  
  318.  
  319. INDENT
  320.  
  321.  
  322.  
  323. Example:    #define indent = 7;
  324.  
  325. Default:   5
  326.  
  327.  
  328.  
  329. The indent variable is the number of characters to move the printhead in before 
  330. printing the data.  The size of a character can be calculated by refering to your 
  331. printers current CPI setting.
  332.  
  333.  
  334.  
  335.  
  336.  
  337. HEADER
  338.  
  339.  
  340.  
  341. Example:    #define header =  "This Is A Header";
  342.  
  343. Default:   None
  344.  
  345.  
  346.  
  347. The header variable is a string of characters that will be printed before each data 
  348. block.  This is handy for printing dates and times etc...  The header may be enclosed 
  349. in quotes but it is not absolutely required but highly recommended.
  350.  
  351.  
  352.  
  353. Headers can also use imbedded codes to produce run-time output for example the 
  354. date or the time.  The imbedded codes are similar to the codes used in the C lan
  355. guage and are listed below:
  356.  
  357.  
  358.  
  359. Escape Codes:
  360.  
  361.  
  362.  
  363. \\        Backslash                \
  364.  
  365. \"        Quote Character            "
  366.  
  367. \d        Date                    01/03/94
  368.  
  369. \e        Escape                ASCII 27
  370.  
  371. \i        Indent 1                Indent's Spaces
  372.  
  373. \n        Newline                ASCII 14
  374.  
  375. \r        Carrage Return            ASCII 13
  376.  
  377. \t        Time                    18:06:51
  378.  
  379. \x        Hex Time 2                2d2c0347
  380.  
  381.  
  382.  
  383. 1    The indent code will indent the following text by the number of spaces de
  384.     fined by the indent variable.
  385.  
  386. 2    The Hex Time code represents the number of seconds passed since January 1, 
  387.     1970 to now.  It is expressed in hexadecimal notation.
  388.  
  389.  
  390.  
  391. Here are some examples of text using embedded codes followed by the actual output 
  392. after compilation.
  393.  
  394.  
  395.  
  396. #define header = "Mailed: \d\r\nAt: \t";
  397.  
  398.  
  399.  
  400. Mailed: 02/11/94
  401.  
  402. At:  19:25:01
  403.  
  404.  
  405.  
  406. #define header = "Code ***\x***";
  407.  
  408.  
  409.  
  410. Code ***2d2c3561***
  411.  
  412.  
  413.  
  414. The possibilities are endless and can add extra style to your mailings without hav
  415. ing to do extra work.  Note if no header is declared then none will be printed.
  416.  
  417.  
  418.  
  419.  
  420.  
  421. FOOTER
  422.  
  423.  
  424.  
  425. Example:    #define footer =  "This Is A Footer";
  426.  
  427. Default:   None
  428.  
  429.  
  430.  
  431. The footer serves the exact same purpose of the header except that it is printed 
  432. proceding every data block instead of before.  The footer variable also excepts a 
  433. string of characters and can contain embedded escape codes.
  434.  
  435.  
  436.  
  437. #define footer = "------------------------------------";
  438.  
  439.  
  440.  
  441. The above will simply print a dotted line after each data block.  Note if no footer is 
  442. declared then none will be printed.
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452. POSTAGE
  453.  
  454.  
  455.  
  456. Example:    #define postage =  0.19;
  457.  
  458. Default:   0.00
  459.  
  460.  
  461.  
  462. The postage variable is only used if you choose to have LL make a summary of your 
  463. mailings at the end of each session.  If you use the report() function in your program 
  464. then the total cost of the mailing session will be computed using the above number 
  465. as the cost for mailing one data block.  The value entered is in dollars and cents and 
  466. can be integer or floating point.
  467.  
  468.  
  469.  
  470. #define postage = .01            // 1 cent for each mailing.
  471.  
  472. #define postage = .1            // 10 cents for each mailing.
  473.  
  474. #define postage = 1;            // $1 for each mailing.
  475.  
  476. #define postage = 1.00;            // $1 for each mailing.
  477.  
  478.  
  479.  
  480. If the postage variable is not declared and a cost summary is requested then the 
  481. compiler will assume there is no mailing cost and substitute a value of 0.00 for the 
  482. postage variable.
  483.  
  484.  
  485.  
  486.  
  487.  
  488. EOL
  489.  
  490.  
  491.  
  492. Example:   #define eol =  crlf;
  493.  
  494. Default:   lf
  495.  
  496.  
  497.  
  498. The EOL variable stands for "End Of Line."  It tells the compiler how to handle a 
  499. situation when it reaches the end of a line and needs to feed the paper.  There are 
  500. two options you can use for the eol variable:
  501.  
  502.  
  503.  
  504. lf
  505.  
  506. crlf
  507.  
  508.  
  509.  
  510. LF means that when you reach the end of a line simply send the linefeed character 
  511. to the printer and continue with printing.  This will work for most printers.
  512.  
  513.  
  514.  
  515. CRLF means that when the end of line is reached make the printer issue a carriage 
  516. return and then do a linefeed.
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524. 2. Printer Commands
  525.  
  526.  
  527.  
  528. L has a built in command called PRINTER.  It's sole purpose is to send commands 
  529. to the printer.  The command is entered in the following way:
  530.  
  531.  
  532.  
  533. printer  " character_string  " ;
  534.  
  535.  
  536.  
  537. Where character_string is a piece of text separated by quotation marks.  The string 
  538. can contain embedded escape codes (see Section 1 "HEADER") and is generally used 
  539. to setup your printer.
  540.  
  541.  
  542.  
  543. With the embedded escape codes you have the ability to send actual setup codes to 
  544. your specific printer using the \E escape code.
  545.  
  546.  
  547.  
  548. printer "\eq1";
  549.  
  550. printer "\eq0";
  551.  
  552.  
  553.  
  554. The above example will turn on the Shadow font on my Epson 5000 printer while 
  555. the second line turns it back off.  So you can easily see that custom printing is easily 
  556. accessible with LL.
  557.  
  558.  
  559.  
  560. The printer command can be issued as many times as needed but can only appear 
  561. before and after the data block.  This was designed for setting up and then resetting 
  562. your printer's defaults.
  563.  
  564.  
  565.  
  566.  
  567.  
  568. 3. The Data  (Data Block)
  569.  
  570.  
  571.  
  572. The main data block follows both the #defines and the printer commands.  This is 
  573. where your data to be printed goes.  In order for the compiler to know about the 
  574. data we use the key word address, after all LL was written for making address la
  575. bels.  Following the word address is the data to be printed enclosed in curly braces.  
  576. Here is the template:
  577.  
  578.  
  579.  
  580. address ( zip_code ) {  data  }  function ;
  581.  
  582.  
  583.  
  584. The function is completely optional and the available functions will be covered in 
  585. section 4.
  586.  
  587.  
  588.  
  589. The zip_code which is entered between the parenthesis is optional.  If a zip code is 
  590. entered then the LL compiler will print the United States Postnet Bar Code for the 
  591. corresponding zip code to the output device.  Postnet will be covered in the next sec
  592. tion (3.1).
  593.  
  594.  
  595.  
  596. The data is unlimited in size.  The data block is allocated dynamically as the pro
  597. gram in run so your printing area is only limited by your available memory.  If you 
  598. run out of memory during a compile then the compiler will issue a fatal warning 
  599. and exit gracefully.  Here is an example:
  600.  
  601.  
  602.  
  603.  
  604.  
  605. address (27302)
  606.  
  607.     {
  608.  
  609.     Kevin McHugh
  610.  
  611.     4671 Mebane Rogers Road
  612.  
  613.     Mebane, NC 27302
  614.  
  615.     } ;
  616.  
  617.  
  618.  
  619. Note that the address block doesn't have to be on one line.  Because the compiler is 
  620. intelligent it knows what we mean so we can make the source code more readable 
  621. for ourselves.  When formatting the data block we position the text just as we want 
  622. it to appear in print.  White space before and after any text is omitted and spacing 
  623. is decided upon your earlier #defines so neatness is not required as LL will take 
  624. care of that for you.
  625.  
  626.  
  627.  
  628. You may specify as many data entries as you wish and in as many different ways as 
  629. you wish, for example:
  630.  
  631.  
  632.  
  633. address ( )
  634.  
  635. {
  636.  
  637. This is my first data block :-)
  638.  
  639. };
  640.  
  641.  
  642.  
  643. address ( ) { This is my second };
  644.  
  645.  
  646.  
  647. address
  648.  
  649. ( )
  650.  
  651. { This is my third and
  652.  
  653. final one for now :) };
  654.  
  655.  
  656.  
  657. So you can see that your style is truly your own.  I tend to format mine like I do my 
  658. C code so you can line up the braces vertically but that is entirely preference.
  659.  
  660.  
  661.  
  662.  
  663.  
  664. 3.1. The PostNet Bar Code Standard
  665.  
  666.  
  667.  
  668. The United States Post Office uses a bar code on their mailing systems for faster 
  669. processing and therefore quicker delivery.  This bar code is a coded representation 
  670. of the addressees zip code.   The zip code may be either a standard Zip or the newer 
  671. more accurate Zip+4 code.
  672.  
  673.  
  674.  
  675. Whichever you choose you have the option of letting LL print the bar code for you.  
  676. At the release date, version 2.0 only supports bar code printing to Epson and IBM 
  677. compatible graphics printers.  Future versions will fully support the Amiga Prefer
  678. ences graphics standard so any Preference printer may be used.
  679.  
  680. LL accesses the graphics modes on the printers directly therefore if you choose your 
  681. output device as PRT: then the graphics characters will be interpreted by Prefer
  682. ences and you will have a row of strange looking characters instead of the bar code.  
  683. To correct this problem we simply bypass the PRT: device and go straight to the 
  684. parallel device PAR:.  This eliminates any interaction on the behalf of Preferences 
  685. and the bar codes will be printed correctly.
  686.  
  687.  
  688.  
  689. NOTE:  PostNet Bar Codes will only be printed correctly if using the PAR: device.
  690.  
  691.  
  692.  
  693. Here is a bar code using the PRT: device.
  694.  
  695.  
  696.  
  697. ¤¤¤¤¤¤¥¥¥¥¥¥yyyyy¤¤¤¤¤¤¤¤
  698.  
  699.  
  700.  
  701. And here is one using PAR:
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711. All LL needs to know in order to print a Postnet Bar Code is the addressees zip 
  712. code.  The way to do this is to pass the zip code as an argument to the address func
  713. tion.  The zip code can be entered as an integer (27302 or 273021234 for the Zip+4), 
  714. or as a string if you wish to use the dash (-) in the Zip+4 format.
  715.  
  716.  
  717.  
  718. Examples:
  719.  
  720.  
  721.  
  722. address (27302)                    // Regular Zip Code As Integer
  723.  
  724.     {
  725.  
  726.     Kevin McHugh
  727.  
  728.     4671 Mebane Rogers Road.
  729.  
  730.     } print;
  731.  
  732.  
  733.  
  734. address ("27302")                    // Regular Zip Code As A String
  735.  
  736.     {
  737.  
  738.     ...
  739.  
  740.     };
  741.  
  742.  
  743.  
  744. address (273021234)                // Zip+4 Format As An Integer
  745.  
  746.     {
  747.  
  748.     ...
  749.  
  750.     };
  751.  
  752.  
  753.  
  754.  
  755.  
  756. address ("27302-1234")                // Zip+4 Format As A String
  757.  
  758.     {
  759.  
  760.     ...
  761.  
  762.     };
  763.  
  764.  
  765.  
  766. Using the Postnet feature is purely optional.  If you do not want the bar code 
  767. printed then do not supply the Zip code between the parenthesis like so:
  768.  
  769.  
  770.  
  771. address ( )
  772.  
  773.     {
  774.  
  775.     Kevin McHugh ...
  776.  
  777.     };
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785. 4. The Data Block Functions
  786.  
  787.  
  788.  
  789. The data blocks which we discussed above are useless without some functions which 
  790. tell the compiler what to do with them.  Each data block may have one function or 
  791. none at all.  If a data block doesn't have its own function then it will inherit the 
  792. function from the block before it.  Here are a list of functions:
  793.  
  794.  
  795.  
  796. print
  797.  
  798. hold
  799.  
  800. copies
  801.  
  802. exit
  803.  
  804.  
  805.  
  806. The function to call is placed after the right brace and before the semi-colon of its 
  807. data block.  The function will then perform its operations on the data block it is 
  808. linked to.
  809.  
  810.  
  811.  
  812. PRINT
  813.  
  814.  
  815.  
  816. Example:    print
  817.  
  818.  
  819.  
  820. The print command simply transfers the data block over to the print spool where it 
  821. is formatted and then output according to all set variables.
  822.  
  823.  
  824.  
  825. HOLD
  826.  
  827.  
  828.  
  829. Example:    hold
  830.  
  831.  
  832.  
  833. The hold function clears the data block buffer and returns control over to the com
  834. piler without formatting the block or printing it.  This is handy if you have a mail
  835. ing list and you are cutting down on expenses.  You can put someone's address on 
  836. hold and keep it in the list without having it printed.  If a data block is on hold it is 
  837. not charged a postage fee (see Section 1 "POSTAGE").
  838.  
  839.  
  840.  
  841.  
  842.  
  843. COPIES
  844.  
  845.  
  846.  
  847. Example:    copies( number_of_copies )
  848.  
  849.  
  850.  
  851. The copies function unlike the others takes an argument.  The argument is an inte
  852. ger and is the number of copies the compiler should make of the current data block.  
  853. Copies will simply continue to call the print function until the compiler has output
  854. ted the number_of_copies requested.  This function is handy for printing out mul
  855. tiple copies of messages on the backs of postcards.
  856.  
  857.  
  858.  
  859.  
  860.  
  861. EXIT
  862.  
  863.  
  864.  
  865. Example:    exit
  866.  
  867.  
  868.  
  869. The exit function calls the print routine on the current data block and then termi
  870. nates compilation.  This is used if you only need to print out a certain portion of the 
  871. mailing list.  Using the exit function frees all memory and resources just like a con
  872. ventional exit.
  873.  
  874.  
  875.  
  876. Here is an example of each function at work:
  877.  
  878.  
  879.  
  880. address ( )
  881.  
  882.     {
  883.  
  884.     Mike Smith
  885.  
  886.     123 My Street
  887.  
  888.     This Town, USA
  889.  
  890.     } print;
  891.  
  892.  
  893.  
  894. This data block will be nicely formatted and then printed to the output file or de
  895. vice.  Note that if the data block doesn't contain any text at all then the compiler 
  896. will issue an error message.
  897.  
  898.  
  899.  
  900.  
  901.  
  902. address ( )
  903.  
  904.     {
  905.  
  906.     Bill Gates
  907.  
  908.     Microsoft Corp.
  909.  
  910.     DOSVille, USA
  911.  
  912.     } hold    ;
  913.  
  914.  
  915.  
  916. This will not print out Bill Gates' address but it will skip it and continue on down 
  917. the list.
  918.  
  919.  
  920.  
  921. address ( )
  922.  
  923.     {
  924.  
  925.     PC User
  926.  
  927.     999 Dos Street
  928.  
  929.     IBM, USA
  930.  
  931.     };
  932.  
  933.  
  934.  
  935. Notice that this block doesn't have a function.  What will happen?  Well this block 
  936. will not be printed but rather skipped.  Why?  Simple, because the last function that 
  937. was processed was the hold function so it is still in effect.  Check for this when 
  938. trouble-shooting.
  939.  
  940.  
  941.  
  942. address ( )
  943.  
  944.     {
  945.  
  946.     Welcome to the monthly postcard!!!
  947.  
  948.     --------------------------------------------------
  949.  
  950.  
  951.  
  952.     Don't miss this months exciting meeting featuring the all new
  953.  
  954.     toaster 4000 and GVP's new EGS 24 bit graphics card.
  955.  
  956.  
  957.  
  958.     Also this month will feature officer elections so come prepared
  959.  
  960.     to vote.
  961.  
  962.  
  963.  
  964.     See you at the meeting!!
  965.  
  966.     } copies(50);
  967.  
  968.  
  969.  
  970. This data block will print 50 copies of the text, neatly formatted and spaced cor
  971. rectly.
  972.  
  973.  
  974.  
  975. address ( )
  976.  
  977.     {
  978.  
  979.     Bill Johnson
  980.  
  981.     862 Main Street
  982.  
  983.     Amigaville, USA 12345-6789
  984.  
  985.     } exit;
  986.  
  987.  
  988.  
  989. This data block will print Bill's address info and then exit the program.
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997. 5. Printer Commands
  998.  
  999.  
  1000.  
  1001. The Printer function is also allowed here after all the data has been processed.  A 
  1002. good example here would be to possible reset your printer to its default settings so 
  1003. when LL exits everything will be the same as when LL was started.
  1004.  
  1005.  
  1006.  
  1007. For more information on the printer command see Section 2.
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015. 6. Functions
  1016.  
  1017.  
  1018.  
  1019. The functions are the very last entry in the source file.  They are not to be confused 
  1020. with the data functions which execute on the data in each data block but these ma
  1021. nipulate the overall process of the compilation.
  1022.  
  1023.  
  1024.  
  1025. REPORT
  1026.  
  1027.  
  1028.  
  1029. Example:    report( );
  1030.  
  1031.  
  1032.  
  1033. This function is responsible for generating a summary both financial and statistical.  
  1034. Here is a sample report generated by the report function:
  1035.  
  1036.  
  1037.  
  1038. Report For Compilation And Processing
  1039.  
  1040. ---------------------------------------------------------------
  1041.  
  1042.  
  1043.  
  1044. Filename:            acug.l
  1045.  
  1046. Submitted At:        Mon Feb  7 20:36:39 1994
  1047.  
  1048. Completed At:        Mon Feb  7 20:36:39 1994
  1049.  
  1050. Compilation:        0 Seconds.
  1051.  
  1052. -------
  1053.  
  1054. Number Of Entries:    20
  1055.  
  1056. Entries Spooled:        22
  1057.  
  1058. Entries Held:        1
  1059.  
  1060. Postage Per Entry:    $0.19
  1061.  
  1062. -----------------------------
  1063.  
  1064. TOTAL POSTAGE    $4.18
  1065.  
  1066.  
  1067.  
  1068. End Of Report.
  1069.  
  1070.  
  1071.  
  1072. The report generated by the report function is output to a file in the current direc
  1073. tory called report.dat.  If for some reason that file could not be created then the re
  1074. port is sent to stdout usually the terminal screen.
  1075.  
  1076.  
  1077.  
  1078. At the time of release no other functions have yet been implemented.
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086. Example Code
  1087.  
  1088.  
  1089.  
  1090. Here is a fully functional piece of L code.  The names have been changed to protect 
  1091. the innocent:
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097. /* demo.l
  1098.  
  1099. **
  1100.  
  1101. ** Sample L Code
  1102.  
  1103. ** List Of Addresses
  1104.  
  1105. **
  1106.  
  1107. ** Last Updated:    February 01, 1994
  1108.  
  1109. **            Kevin McHugh
  1110.  
  1111. **
  1112.  
  1113. **
  1114.  
  1115. ** Standard Postcard Size:  24x60 @ (6 lpi)
  1116.  
  1117. **
  1118.  
  1119. */
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125. #define indent    = 20;
  1126.  
  1127. #define space    = 12;
  1128.  
  1129. #define height    = 24;
  1130.  
  1131. #define width    = 60;
  1132.  
  1133. #define device    = out;
  1134.  
  1135. #define eol    = lf;
  1136.  
  1137. #define postage    = 0.19;
  1138.  
  1139. #define header    = ***-\d-***;
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145. printer "\e2";            // Selects 6 lines per inch spacing.
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151. address ( )
  1152.  
  1153.     {
  1154.  
  1155.     Jerry Smith
  1156.  
  1157.     123 Main Street
  1158.  
  1159.     New York, NY
  1160.  
  1161.     } print;
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169. address (27302)
  1170.  
  1171.     {
  1172.  
  1173.     Kevin McHugh
  1174.  
  1175.     4671 Mebane Rogers Road
  1176.  
  1177.     Mebane, NC 27302
  1178.  
  1179.     } hold;                // No Point In Mailing Myself A Postcard.
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187. address ( )
  1188.  
  1189.     {
  1190.  
  1191.     Steven Jones
  1192.  
  1193.     987 Teacup Ave.
  1194.  
  1195.     Los Angeles, CA
  1196.  
  1197.     } print;
  1198.  
  1199.  
  1200.  
  1201. address ( )
  1202.  
  1203.     {
  1204.  
  1205.     Bart Simpson
  1206.  
  1207.     346 Nice Lane
  1208.  
  1209.     Foxville, IL
  1210.  
  1211.     } print;
  1212.  
  1213.  
  1214.  
  1215. address ( )
  1216.  
  1217.     {
  1218.  
  1219.     Jimmy Albert
  1220.  
  1221.     701 Malone Rd.
  1222.  
  1223.     Smithville, TN
  1224.  
  1225.     } hold;                // Hasn't Paid His Membership Fees This Year.
  1226.  
  1227.  
  1228.  
  1229. address (90210)
  1230.  
  1231.     {
  1232.  
  1233.     Kenneth Thomas
  1234.  
  1235.     0101 Binary Ave.
  1236.  
  1237.     Beverly Hills, CA 90210
  1238.  
  1239.     } print;
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245. /* End Of Addresses */
  1246.  
  1247.  
  1248.  
  1249. report();                    // Generate Cost Report.
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257. The above code segment gives a simple but effective look at how easy and versatile 
  1258. the LL compiler is.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266. Using LL
  1267.  
  1268.  
  1269.  
  1270. LL can only be used from the shell or from the Execute command under workbench.  
  1271. The format for LL is as follows:
  1272.  
  1273.  
  1274.  
  1275. LL v1.5 (C) Feb  7 1994, McHugh Data Systems
  1276.  
  1277. A Label Language Compiler.
  1278.  
  1279.  
  1280.  
  1281. Usage: ll <options> <source file>
  1282.  
  1283.  
  1284.  
  1285. At the present time LL only supports one option.  The -c option which means to com
  1286. pile the code only but not produce any output.  This is a handy feature for debugging 
  1287. code.  It will run as normal but no output will be produced.  However, a report will 
  1288. be produced if requested as it is not part of the formatted output of LL.  Example:
  1289.  
  1290.  
  1291.  
  1292. Shell>  ll -c demo.l
  1293.  
  1294.  
  1295.  
  1296. Compile demo.l only.  Don't produce output.
  1297.  
  1298.  
  1299.  
  1300. Shell> ll demo.l
  1301.  
  1302.  
  1303.  
  1304. Compile and produce output based on the file demo.l
  1305.  
  1306.  
  1307.  
  1308. Just issuing the LL command by itself will bring up the template.
  1309.  
  1310.  
  1311.  
  1312. There are multiple versions of LL in the archive:
  1313.  
  1314.  
  1315.  
  1316. LL        LL for 68000 Amigas
  1317.  
  1318. LL020    LL for 68020, 68030, 68040 Amigas
  1319.  
  1320. LL020881    LL for 68020 or better and 68881, 68882 Math Coprocessors.
  1321.  
  1322.  
  1323.  
  1324. Just copy the appropriate executable to C:ll and you're all installed.
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330. Registering LL
  1331.  
  1332.  
  1333.  
  1334. LL is freeware but I would appreciate it if you would drop me a line and let me 
  1335. know you are using it; that way I will know whether to publicly release future up
  1336. dates and type all this documentation.
  1337.  
  1338.  
  1339.  
  1340. Incase you are reading all these docs in text then you may not know that there is a 
  1341. handsomely bound professional 20 page printed manual which is included in the ar
  1342. chive as manual.ps but can be obtained from me by sending cash or money order for 
  1343. $10 US.
  1344.  
  1345.  
  1346.  
  1347. As mentioned in the disclosure you can obtain the source code for LL.  If  you wish 
  1348. to have the source code then send cash or money order in US dollars for $12 and I 
  1349. will mail you the complete source and latest executables.  Add $8 for the manual.
  1350.  
  1351. Technical Info About LL
  1352.  
  1353.  
  1354.  
  1355. LL consists of a top-down one pass parser which is responsible for all syntactical 
  1356. and grammatical findings.  The parser is fed a token from the lexicographical scan
  1357. ner which dynamically scans the file and can maneuver bidirectionally.
  1358.  
  1359.  
  1360.  
  1361. The scanner was hand written in C rather than using a parser generator such as 
  1362. lex, or flex.  The main reason was for speed and grace and the code size was reduced 
  1363. from around 17k to 7k.  The parser was also written in C instead of using yacc or 
  1364. bison for similar reasons.  The governing reason was that I wanted some practise at 
  1365. optimizing the compile time.  As of yet I have not found a file that takes over 2 sec
  1366. onds to compile on my 68030 machine.
  1367.  
  1368.  
  1369.  
  1370. Error generation and attempted correction is handled by a subset of the parser in 
  1371. order to continue after minor mistakes like missing = or ; 's etc...  Error traps also 
  1372. catch illegal type assignments such as string to integer or float.  Such an error will 
  1373. cause a FATAL signal and the compiler will close down as it assumes you will want 
  1374. to edit your code.
  1375.  
  1376.  
  1377.  
  1378. When the compiler exits, either normally or otherwise the atexit() function is called.  
  1379. This flushes all I/O and releases file descriptors on all open files and devices.  All in 
  1380. use memory is cleaned and then put back on the heap so that your other programs 
  1381. will not be in need for those precious bytes.
  1382.  
  1383.  
  1384.  
  1385. If this tickles your fancy consider ordering the source code so you can improve or 
  1386. just learn from it.
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398. Future Improvements
  1399.  
  1400.  
  1401.  
  1402. *    More buffered stream I/O.
  1403.  
  1404. *    User defined variables.
  1405.  
  1406. *    Better compiler intelligence and correction.
  1407.  
  1408. *    Multiple source files.
  1409.  
  1410. *    Ability to #include text into data blocks.
  1411.  
  1412. *    Operands  ( + - / * )
  1413.  
  1414. *    More global functions.
  1415.  
  1416. *    More embedded escape codes.
  1417.  
  1418. *    Faster, faster, faster.....
  1419.  
  1420. Acknowledgements
  1421.  
  1422.  
  1423.  
  1424. Editor:        Cygnus-Ed Professional Release 3.5
  1425.  
  1426. Compiler:        Manx/Aztec C Developer v5.2a
  1427.  
  1428. Documentation:    WordPerfect v4.2 Amiga
  1429.  
  1430. PostNet:        Chris Laforet Software
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438. History
  1439.  
  1440.  
  1441.  
  1442. Version    Descripion
  1443.  
  1444.  
  1445.  
  1446. 1.0        Quick ugly label printer.  Used text file for address information
  1447.  
  1448.         seperated by blank spaces.  All paper sizes hard coded.
  1449.  
  1450. 1.1        Changed hard coded paper sizes to #defines for multiple documents.
  1451.  
  1452. 1.2        Scrapped the whole idea and re-wrote with an intelligent text
  1453.  
  1454.         processor in mind.
  1455.  
  1456. 1.3        First working version with a seperate token scanner (Lex).
  1457.  
  1458. 1.4        Deleted all Lex code and hand wrote the scanner from scratch.
  1459.  
  1460. 1.5        New revised version of the scanner using character based I/O
  1461.  
  1462.         and tokens.  Also included seperate parser for language grammar.
  1463.  
  1464. 1.6        Added variables and Data functions to perform other than printing
  1465.  
  1466.         abilities.
  1467.  
  1468. 1.7        Added ability to support external functions in the language and
  1469.  
  1470.         coded a function to generate statistical reports.
  1471.  
  1472. 1.8        Added feature for issuing flags on the command line.  Only one
  1473.  
  1474.         exists to date (-c compile only.)
  1475.  
  1476. 1.9        Postnet Bar Coding was added and yet another change to the
  1477.  
  1478.         grammar to incorporate this into the address function.
  1479.  
  1480. 2.0        First public release of LL and first revision of user documentation.
  1481.  
  1482.  
  1483.  
  1484.